/**
Date: 2025-08-13
Copyright (c) 2025 Industrial Software Feature Database
*/
import request from '@/utils/request';
import { OssQuery, OssVO } from './types';
import { AxiosPromise } from 'axios';

// 查询OSS对象存储列表
export function listOss(query: OssQuery): AxiosPromise<OssVO[]> {
  return request({
    url: '/model/list',
    method: 'get',
    params: query
  });
}

// 查询OSS对象基于id串
export function listByIds(ossId: string | number): AxiosPromise<OssVO[]> {
  return request({
    url: '/resource/oss/listByIds/' + ossId,
    method: 'get'
  });
}

// 删除OSS对象存储
export function delOss(ossId: string | number | Array<string | number>) {
  return request({
    url: '/model/' + ossId,
    method: 'delete'
  });
}
// 查询
export function listPros(query: OssQuery): AxiosPromise<OssVO[]> {
  return request({
    url: '/isfd/preProcess/model/list',
    method: 'get',
    params: query
  });
}

// 查询OSS对象基于id串
export function listProByIds(ossId: string | number): AxiosPromise<OssVO[]> {
  return request({
    url: '/resource/oss/listByIds/' + ossId,
    method: 'get'
  });
}

// 删除OSS对象存储
export function delPro(ossId: string | number | Array<string | number>) {
  return request({
    url: '/isfd/preProcess/model/' + ossId,
    method: 'delete'
  });
}

// 查询
export function listResult(query: OssQuery): AxiosPromise<OssVO[]> {
  return request({
    url: '/isfd/preProcess/result/list',
    method: 'get',
    params: query
  });
}

// 删除OSS对象存储
export function delResult(ossId: string | number | Array<string | number>) {
  return request({
    url: '/isfd/preProcess/result/' + ossId,
    method: 'delete'
  });
}

// 下载word
export function downLoadFile(data) {
  return request({
    url: '/isfd/preProcess/model/download/' + data.id,
    method: 'get',
    data,
    responseType: 'blob'
  });
}
// 下载word
export function downLoadResultFile(data) {
  return request({
    url: '/isfd/preProcess/result/download/' + data.id,
    method: 'get',
    data,
    responseType: 'blob'
  });
}
// 预览
export function preiewFile(id) {
  return request({
    url: '/model/load?id=' + id,
    method: 'get'
  });
}
// 预览
export function prosPreiewFile(id) {
  return request({
    url: '/isfd/preProcess/model/load?id=' + id,
    method: 'get'
  });
}
export function parametricFileView(id) {
  return request({
    url: '/isfd/modelParametric/load?id=' + id,
    method: 'get'
  });
}

// 查询参数化建模列表
export function listParametric(query){
  return request({
    url: '/isfd/modelParametric/list',
    method: 'get',
    params: query
  });
}
// 删除参数化建模
export function delParametric(id){
  return request({
    url: '/isfd/modelParametric/' + id,
    method: 'delete'
  });
}
export function downLoadParametric(data) {
  return request({
    url: '/isfd/modelParametric/download/' + data.id,
    method: 'get',
    data,
    responseType: 'blob'
  });
}